<?php

namespace App\Http\Controllers\User;

use App\Http\Classes\UserLesson;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class WordController extends Controller
{
    /*
     * 用户单词测试
     * GET
     * lesson（int)
     * 用户自建的课程ID号
     */
    public function getTestWords(Request $request)
    {
        try
        {
            if ( $request->has('lesson') )
            {
                $lesson = new UserLesson($request->get('lesson'));
                $words = $lesson->getTestWordsWithOutRemember($_COOKIE['USER_ID']);
                return $this->response(1, 'success', $words);
            }
            else
            {
                return $this->response(0, '缺少参数');
            }
        }
        catch (\Exception $exception)
        {
            return $this->exceptionResponse($exception, __FUNCTION__);
        }
    }
}
